<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>会员基本信息</title>
<link rel="stylesheet" type="text/css" href="../../css/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../../css/themes/icon.css" />
<script type="text/javascript" src="../../js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="../../js/jquery.form.js"></script>
<script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../js/ListData.js"></script>
<script type="text/javascript">
	$.extend($.fn.validatebox.defaults.rules, {
		length : {
			validator : function(value, param) {
				return value.length == param[0];
			},
			message : '请输入18位合法的身份证号！'
		}
	});
	$.fn.datebox.defaults.formatter = function(date) {
		var y = date.getFullYear();
		var m = date.getMonth() + 1;
		m = m < 10 ? "0" + m : m;
		var d = date.getDate();
		d = d < 10 ? "0" + d : d;
		return y + '-' + m + '-' + d;
	}
	$.fn.combo.defaults.panelHeight = 200;
	function loadData(data) {
		$('#member_info').form("load", data);
	}
	function alterAction(url) {
		$("#member_info").attr("action", url);
	}
	function clearForm() {
		$('#member_info').clearForm();
	}
	$(function() {
		if ($("#readonly").val() === "readonly") {
			readOnly();
		}
		$('#member_info').submit(function() {
			$(this).ajaxSubmit({
				clearForm : true,
				beforeSerialize : function() {
				},
				beforeSubmit : function(formDatas, form, option) {
					var canSubmit = true;
					$(formDatas).each(function(i, field) {
						if ("idNumber" == this.name) {
							if ("" == this.value) {
								canSubmit = false;
								alert("请填写身份证号！");
								return false;
							}
						}
					});
					return canSubmit;
				},
				success : function() {
					window.top.buildTree();
					window.parent.refresh();
				}
			});
			return false;
		});

	})
	function readOnly() {
		$($("input")).each(function() {
			$(this).attr("disabled", "disabled");
		});
		$($("select")).each(function() {
			$(this).attr("disabled", "disabled");
		});
		$($("textarea")).each(function() {
			$(this).attr("disabled", "disabled");
		});
		$($("button")).each(function() {
			$(this).hide();
		});
	}
	function checkIDNumber(e) {
		$.get("../../member/verifyIDNumber", {
			idNumber : $(e).val()
		}, function(str) {
			if (str == "false") {
				e.focus();
			}
		});
	}
</script>
<style type="text/css">
body {
	margin: 0px;
	padding: 0px;
	width: 100%;
	height: 100%;
}

form {
	font-size: 13px;
	font-weight: 400;
}
</style>
</head>
<body style="margin: 0">
	<form id="member_info" name="member_info" method="post" action="../../member/add">
		<table>
			<tr>
				<td nowrap="nowrap" width="100" align="right">会员姓名：</td>
				<td nowrap="nowrap" width="200" align="left"><input name="name" id="name" /><input name="id" id="id" type="hidden" /></td>
			</tr>
			<tr>
				<td nowrap="nowrap" width="100" align="right">身份证号：</td>
				<td nowrap="nowrap" width="200" align="left"><input name="idNumber" id="idNumber" size="40" class="easyui-validatebox" data-options="required:true,validType:'length[18]'" /></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<button type="submit">提交</button>
				</td>
			</tr>
		</table>
	</form>
	<input name="readonly" id="readonly" value="<%=request.getParameter("readonly")%>" type="hidden" />
</body>
</html>